/**
 * 
 */
package co.fitstart.entity.content.page;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Type;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * 文案
 * 
 * @author Leo
 * @author lute
 */
@Entity
@Table(name="content_brief")
@JsonIgnoreProperties(value={"hibernate_lazy_initializer","handler","fieldHandler"})
public class Brief {

    @Id
    @GeneratedValue
    private Long id;
    
    /** 所在页面 */
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JSONField(serialize = false)
    private Webpage webpage;
    
    /** 文案ID */
    @JSONField(serialize = false)
    private String alias;
    
    /** 文案标题 */
    private String title;
    
    /** 文案副标题 */
    @Column(name = "sub_title")
    private String subTitle;
    
    /** 文案内容 */
    @Type(type = "text")
    private String description;
    
    @JSONField(serialize = false)
    private Date createTime;
    
    @JSONField(serialize = false)
    private Date lastUpdateTime;
    
    @Column(name = "is_disabled")
    @JSONField(serialize = false)
    private boolean disabled;
    
    /**
     * The default constructor
     */
    public Brief() {
    
    }
    
    /**
     * edit title and description
     * 
     * @return
     */
    public Brief edit() {
        this.lastUpdateTime = new Date();
        return this;
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @return the webpage
     */
    public Webpage getWebpage() {
        return webpage;
    }

    /**
     * @return the alias
     */
    public String getAlias() {
        return alias;
    }

    /**
     * @return the title
     */
    public String getTitle() {
        return title;
    }

    /**
     * @return the subTitle
     */
    public String getSubTitle() {
        return subTitle;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @return the createTime
     */
    public Date getCreateTime() {
        return createTime;
    }

    /**
     * @return the lastUpdateTime
     */
    public Date getLastUpdateTime() {
        return lastUpdateTime;
    }

    /**
     * @return the disabled
     */
    public boolean isDisabled() {
        return disabled;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @param webpage the webpage to set
     */
    public void setWebpage(Webpage webpage) {
        this.webpage = webpage;
    }

    /**
     * @param alias the alias to set
     */
    public void setAlias(String alias) {
        this.alias = alias;
    }

    /**
     * @param title the title to set
     */
    public void setTitle(String title) {
        this.title = title;
    }

    /**
     * @param subTitle the subTitle to set
     */
    public void setSubTitle(String subTitle) {
        this.subTitle = subTitle;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * @param createTime the createTime to set
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    /**
     * @param lastUpdateTime the lastUpdateTime to set
     */
    public void setLastUpdateTime(Date lastUpdateTime) {
        this.lastUpdateTime = lastUpdateTime;
    }

    /**
     * @param disabled the disabled to set
     */
    public void setDisabled(boolean disabled) {
        this.disabled = disabled;
    }

}
